package com.example.hrmspractice.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.example.hrmspractice.domain.ApiResponse;
import com.example.hrmspractice.domain.Employee;
import com.example.hrmspractice.service.EmployeeService;
import com.example.hrmspractice.mapper.EmployeeMapper;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;

/**
* @author XZH
* @description 针对表【employee】的数据库操作Service实现
* @createDate 2024-12-18 20:22:54
*/
@Service
@RequiredArgsConstructor
public class EmployeeServiceImpl extends ServiceImpl<EmployeeMapper, Employee>
    implements EmployeeService{
    private final EmployeeMapper employeeMapper;
    public ApiResponse add(Employee employee) {
        int result = employeeMapper.insert(employee);
        return result > 0 ? ApiResponse.success() : ApiResponse.error("添加失败");
    }
    public ApiResponse update(Employee employee) {
        int result = employeeMapper.updateById(employee);
        return result > 0 ? ApiResponse.success() : ApiResponse.error("修改失败");
    }
}




